

export default class MainAction{
    constructor(comp){
        this.comp = comp
    }

    appConfig ={
        appcode: '',
        pagecode: ''
    }

    getTemplate =()=>{
        const {props} = this.comp
        const {dispatch,createUIDom,meta,button} = props
        createUIDom(appConfig,(data)=>{
            meta.setMeta(data.template)
            button.setButton(data.button)
        })
    }

    getMulitiLange =()=>{
        const {props} = this.comp
        const {dispatch,MultiInit} = props
        MultiInit.getMulitiLange({
            moduleId: 'gx6008',
            domainName: 'hryf',
            callback: (json,status,init)=>{
                dispatch({
                    type: 'main/update',
                    payload: {
                        json: json
                    }
                })
            }
        })
    }

    subscribe =()=>{
        const {comp:{action},PubSub} = this
        PubSub.publish('queryTableData',(...args)=>{
            action.pubAction.queryTableData(...args)
        })
    }

     // 卸载
     willUnMount = () => {
        this.pubSub.unSubscribe('queryTableData');
    }


    didMound =()=>{
        this.subscribe()
    }
}